<?php
include '../include.php';
ini_set('display_errors', 1);


$time1 = floor(time()/1800)*1800; // now
$time2 = floor(time()/1800)*1800-1800; // old

$query = 'SELECT COUNT(1) as cnt FROM `stat__online_onlineusers` WHERE `time`='.$time1;
$cnt1 = _database::torow($query);
$cnt1 = $cnt1['cnt'];


$query = 'SELECT COUNT(1) as cnt FROM `stat__online_onlineusers` WHERE `time`='.$time2;
$cnt2 = _database::torow($query);
$cnt2 = $cnt2['cnt'];

$query = ' DELETE FROM `stat__online_onlineusers` WHERE `time`<'.$time2;
_database::query($query);

Statistic::set('online_30', $cnt1);
Statistic::set('online_30', $cnt2, $time2);
?>
